<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/static/commons/taglibs.jsp"%>
<%@ include file="/static/commons/meta.jsp"%>
<%@ include file="/static/commons/jquery-easyui.jsp"%>
<html >
	 <head>
 		<title>${title }</title>
 		 <link rel="stylesheet" href="${ctx }/static/styles/basic/basic.css" />
		 <link rel="stylesheet" href="${ctx }/static/styles/frame/main.css" />
		 <link rel="stylesheet" href="${ctx }/static/styles/frame/searchBtn.css" />
		 <link rel="stylesheet" href="${ctx }/static/styles/frame/searchCondition.css" />
	    <!-- js -->
 		<script language="JavaScript" src="${ctx}/static/scripts/check_all.js"></script>
 		<script language="JavaScript" src="${ctx}/static/scripts/set_select.js"></script>
 		<script language="JavaScript" src="${ctx}/static/scripts/waiting.js"></script>
 		<script language="JavaScript" src="${ctx}/static/scripts/crud.js"></script>
 		<script language="JavaScript" src="${ctx}/static/scripts/util.js"></script>
 		<script language="JavaScript" src="${ctx}/static/scripts/common.js"></script>
		<script language="javascript"src="${ctx}/static/scripts/WdatePicker/WdatePicker.js"></script>
	</head>
  <body onload="init()">
		<form action="${ctx}/buyAudit/list" method="post">
  			<input type="hidden" name="RequestVerificationToken" value="${RequestVerificationToken}" />
			<div class="width_100 group_box">
				<div class="group_search width_100">
					<vvise:select id="status" name="p_status" sqlname="getCodeData" sqlparam="buy_status" displayText="状态" ifSearch="true"   />
					<vvise:searchInput id="buyUser" name="p_buyUser" displayText="申请人" />
					<vvise:searchInput id="supplierName" name="p_supplierName" displayText="供应商" />
					<vvise:searchInput id="startDate" name="p_startDate" defVal="${startDate}" 
			                endId="endtDate" endName="p_endtDate" endDefVal="${endDate}"
			                 type="time2" displayText="申请日期" dateFormat="yyyy-MM-dd"/>
               	 	<div class="clear_both"></div>
				</div>
				<vvise:funMenu menuId="${menuId}" />
			</div>
        </form>
        <div class="listFrame">
        	<iframe name="listFrame" id="listFrame" frameBorder="0"
				scrolling="auto" style="width: 100%;height:100%;"></iframe>
        </div>
	</body>
	<script language="javaScript">
  		var headers = {};
		headers['__RequestVerificationToken'] = "${RequestVerificationToken}";
			//回车事件
		document.onkeydown = keyKistener;
		function keyKistener(e){
			e = e ? e:event;
			if(e.keyCode == 13){
				try{
					search();
				}catch(e){}
			}
		}
		function init(){
			set_iframe_h();
			$(window).resize(function(){
				set_iframe_h();
			});
			search();
			$('.easyui-combobox').combobox();
		}
		//设置ifream 高度
		function set_iframe_h(){
			var win_height  = $(window).height();
			var func_line_h = $('.group_box').outerHeight(true);
			var list_height = win_height - func_line_h;
			$('.listFrame').css('height',list_height-10);
		}
		function search(){
			waiting();
			document.forms[0].target = "listFrame";
			document.forms[0].submit();
		}
		
		function dirAudit(buyId){
			var pp = parent;
			var ecForm = listFrame.document.all.ec;
			if(!checkSelect(ecForm.id,false,'审核'))
				return;
			var buyId = get_checkbox_value(ecForm.id);
			var director = listFrame.document.getElementById('director_'+buyId).value;
			if(!isEmpty(director)){
				pp.alertMsg('主管已审核，无法重复审核！','warning',function(){
				});
				return;
			}
			doCreate("采购审核信息",pp.width3+100,460,"${ctx}/buyAudit/edit?buyId="+buyId+"&auditType=1");
		}
		
		function mgrAudit(buyId){
			var pp = parent;
			var ecForm = listFrame.document.all.ec;
			if(!checkSelect(ecForm.id,false,'审核'))
				return;
			var buyId = get_checkbox_value(ecForm.id);
			var director = listFrame.document.getElementById('director_'+buyId).value;
			if(isEmpty(director)){
				pp.alertMsg('主管未审核，无法审核！','warning',function(){
				});
				return;
			}
			doCreate("采购审核信息",pp.width3+100,460,"${ctx}/buyAudit/edit?buyId="+buyId+"&auditType=2");
		}
		
		function save(){
			var pp = parent;
			var editFrame = pp.winFrame;
			var buyId = editFrame.$('#buyId').val();
			doSave("${ctx}/buyAudit/save",buyId);
		}
		
		function view(buyId){
			var pp = parent;
			doView("采购信息",pp.width3+100,460,"${ctx}/buyAudit/edit?buyId="+buyId+"&view=view");
		}
		
		</script>
</html>